package com.stage.models;

import javax.persistence.*;

/**
 * Created by Stage on 2017/4/16.
 */
@Entity
@Table(name = "Teacher", schema = "dbo", catalog = "JavaHomeWork")
public class TeacherEntity {
    private int id;
    private String name;
    private String idNo;
    private String classNumber;

    @Id
    @Column(name = "Id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "Name", nullable = false, length = 50)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "IdNo", nullable = false, length = 50)
    public String getIdNo() {
        return idNo;
    }

    public void setIdNo(String idNo) {
        this.idNo = idNo;
    }

    @Basic
    @Column(name = "ClassNumber", nullable = false, length = 50)
    public String getClassNumber() {
        return classNumber;
    }

    public void setClassNumber(String classNumber) {
        this.classNumber = classNumber;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        TeacherEntity that = (TeacherEntity) object;

        if (id != that.id) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (idNo != null ? !idNo.equals(that.idNo) : that.idNo != null) return false;
        if (classNumber != null ? !classNumber.equals(that.classNumber) : that.classNumber != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (idNo != null ? idNo.hashCode() : 0);
        result = 31 * result + (classNumber != null ? classNumber.hashCode() : 0);
        return result;
    }
}
